<?php
/**
 * Name: function.php
 * Description:
 * User: DIY
 * Date: 2016/9/7
 * Time: 9:07
 */

/*
 * 验证用户登录
 * return user_id
 * */
function check_login(){
    $user = cookie('admin_user');
    if(empty($user)){
        return '';
    }
    $AuthEncrypt = new \Common\Library\AuthEncrypt();
    //设置动态加密KEY和有效期
    $AuthEncrypt->setExpiry(C('AUTH_EXPIRE'));
    $AuthEncrypt->setKey(C('AUTH_KEY'));
    return $AuthEncrypt->decode($user);
}
